﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;

using DevWeb.Biztalk.DeploymentSettings.WebUI.Models;

namespace DevWeb.Biztalk.DeploymentSettings.WebUI.Automapper
{
    public class IntegrationVersionViewProfile : Profile
    {
        public const string ViewModel = "IntegrationVersionViewProfile";

        public override string ProfileName
        {
            get { return ViewModel; }
        }

        protected override void Configure()
        {
            CreateMaps();
        }

        private static void CreateMaps()
        {
            Mapper.CreateMap<Data.CodeFirst.IntegrationVersion, IntegrationVersionViewModel>();
                //.ForMember(dest => dest.DeploymentLogs,opt => opt.MapFrom(s=>s.DeploymentLog.ToList()))
                //.ForSourceMember(s => s.Integration, t => t.Ignore())
                //.ForSourceMember(s => s.DeploymentLog, t => t.Ignore());

            //Mapper.CreateMap<Data.CodeFirst.IntegrationVersion, IntegrationVersionViewModel>();
            //    // .ForMember(dest => dest.DeploymentLogs,opt => opt.MapFrom(s=>s.DeploymentLog.ToList()))

            //   //.ForSourceMember(s => s.Integration, t => t.Ignore())
              
            //   //.ForSourceMember(s => s.DeploymentLogs, t => t.Ignore());




            //Mapper.CreateMap<Data.CodeFirst.IntegrationVersion, IntegrationVersionViewModel>();
                // .ForMember(dest => dest.DeploymentLogs,opt => opt.MapFrom(s=>s.DeploymentLog.ToList()))

                //.ForSourceMember(s => s.Integration, t => t.Ignore())
                //.ForMember(t => t.DeploymentLogs, opt => opt.Ignore())
                //.ForSourceMember(s => s.DeploymentLog, t => t.Ignore());

            Mapper.CreateMap<IntegrationVersionViewModel, Data.CodeFirst.IntegrationVersion>();
               
              //  .ForMember(t => t.DeploymentLog, opt => opt.Ignore())
              ////  .ForMember(t => t.IntegrationVersionSettings, opt => opt.Ignore())
              //  .ForMember(t => t.Integration, opt => opt.Ignore())
              //  .ForMember(t => t.IntegrationName, opt => opt.Ignore())
              //  .ForSourceMember(s => s.ProductUpgradeCode, t => t.Ignore())
              //  .ForSourceMember(s => s.SettingCount, t => t.Ignore())
              //   .ForSourceMember(s => s.DeploymentLogs, t => t.Ignore())
              //  .ForSourceMember(s => s.DeploymentCount, t => t.Ignore());


            Mapper.CreateMap<IntegrationVersionViewModel, Data.CodeFirst.IntegrationVersion>();

               //.ForMember(t => t.DeploymentLogs, opt => opt.Ignore())
               // //  .ForMember(t => t.IntegrationVersionSettings, opt => opt.Ignore())
               //.ForMember(t => t.Integration, opt => opt.Ignore())
               //.ForMember(t => t.IntegrationName, opt => opt.Ignore())
               //.ForSourceMember(s => s.ProductUpgradeCode, t => t.Ignore())
               //.ForSourceMember(s => s.SettingCount, t => t.Ignore())
               // .ForSourceMember(s => s.DeploymentLogs, t => t.Ignore())
               //.ForSourceMember(s => s.DeploymentCount, t => t.Ignore());


            Mapper.CreateMap<IQueryable<IntegrationVersionViewModel>, IQueryable<Data.CodeFirst.IntegrationVersion>>();
            Mapper.CreateMap<IQueryable<IntegrationVersionViewModel>, IQueryable<Data.CodeFirst.IntegrationVersion>>();
        }
    }
}